﻿using MediatR;
using Swork03_28.Api.Application.Commands.FarmedCommand;
using Swork03_28.Domain.TraceableInfos;
using Swork03_28.Services.Interface;

namespace Swork03_28.Api.Application.CommandHandlers.FarmedHandler
{
    public class FarmedSelectCommandHandler : IRequestHandler<FarmedSelectCommand, List<Farmed>>
    {
        private readonly IFarmedService farmedService;

        public FarmedSelectCommandHandler(IFarmedService farmedService)
        {
            this.farmedService = farmedService;
        }



        public async Task<List<Farmed>> Handle(FarmedSelectCommand request, CancellationToken cancellationToken)
        {
            var info = await farmedService.GetValues(x => x.BatchId == request.Batch);
            return info;
        }
    }
}
